/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import util.InterfaceUtente;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.GenerationType;
import javax.persistence.GeneratedValue;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author grillo
 */
@Entity
@Table(name = "docente")
@NamedQueries({@NamedQuery(name = "Docente.findAll", query = "SELECT d FROM Docente d"), @NamedQuery(name = "Docente.findByMatricola", query = "SELECT d FROM Docente d WHERE d.matricola = :matricola"), @NamedQuery(name = "Docente.findByNome", query = "SELECT d FROM Docente d WHERE d.nome = :nome"), @NamedQuery(name = "Docente.findByCognome", query = "SELECT d FROM Docente d WHERE d.cognome = :cognome"), @NamedQuery(name = "Docente.login", query = "SELECT u FROM Docente u WHERE u.matricola = :matricola AND u.password = :password"), @NamedQuery(name = "Docente.findByMail", query = "SELECT d FROM Docente d WHERE d.mail = :mail"), @NamedQuery(name = "Docente.findByTelefono", query = "SELECT d FROM Docente d WHERE d.telefono = :telefono"), @NamedQuery(name = "Docente.findByImg", query = "SELECT d FROM Docente d WHERE d.img = :img")})
public class Docente implements Serializable, InterfaceUtente {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "matricola")
    private Integer matricola;
    @Basic(optional = false)
    @Column(name = "nome")
    private String nome;
    @Basic(optional = false)
    @Column(name = "cognome")
    private String cognome;
    @Basic(optional = false)
    @Column(name = "password")
    private String password;
    @Column(name = "mail")
    private String mail;
    @Column(name = "telefono")
    private String telefono;
    @Column(name = "img")
    private String img;
    @OneToMany(mappedBy = "matricolaDocente")
    private List<Esame> esameCollection;

    public Docente() {
    }

    public Docente(Integer matricola) {
        this.matricola = matricola;
    }

    public Docente(Integer matricola, String nome, String cognome, String password) {
        this.matricola = matricola;
        this.nome = nome;
        this.cognome = cognome;
        this.password = password;
    }

    public Integer getMatricola() {
        return matricola;
    }

    public void setMatricola(Integer matricola) {
        this.matricola = matricola;
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getCognome() {
        return cognome;
    }

    public void setCognome(String cognome) {
        this.cognome = cognome;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }

    public String getTelefono() {
        return telefono;
    }

    public void setTelefono(String telefono) {
        this.telefono = telefono;
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img;
    }

    public List<Esame> getEsameCollection() {
        return esameCollection;
    }

    public void setEsameCollection(List<Esame> esameCollection) {
        this.esameCollection = esameCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (matricola != null ? matricola.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Docente)) {
            return false;
        }
        Docente other = (Docente) object;
        if ((this.matricola == null && other.matricola != null) || (this.matricola != null && !this.matricola.equals(other.matricola))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Docente[matricola=" + matricola + "]";
    }

}
